package book;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-05-19
 * Time: 8:20
 */
//书架
public class BookList {
    private Book[] books = new Book[10]; //最多放10本书，这里不过多设计

    private int useSize; //实时记录书架上有多少书

    //默认书架上有三本书
    public BookList() {

        books[0] = new Book("三国演义","罗贯中","小说",77);
        books[1] = new Book("三体","刘慈欣","小说",97);
        books[2] = new Book("活着","余华","小说",57);

        useSize = 3;
    }

    /**
     *
     * @param pos  pos位置一定是合法位置
     * @param book  一本书
     *      在某个位置上添加一本书
     */
    public void setBook(int pos,Book book){
         books[pos] = book;
    }

    /**
     *
     * @param pos  pos位置一定是合法位置
     * @return  获取某个位置上的书
     */
    public Book getBook(int pos){
        return books[pos];
    }

    /**
     *
     * @param useSize  实时记录图书的数量
     */
    public void setUseSize(int useSize){
        useSize = useSize;
    }

    /**
     *
     * @return 实时获取图书的数量
     */
    public int getUseSize(){
        return useSize;
    }

}
